﻿using DotNetFramework.CAP.Core.Logger;
using DotNetFramework.CAP.NodeDiscovery;
using DotNetFramework.CAP;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DotnetFramework.CAP.Consul
{
    public class DiscoveryProviderFactory : IDiscoveryProviderFactory
    {
        private readonly ILoggerFactory _loggerFactory;

        public DiscoveryProviderFactory(ILoggerFactory loggerFactory)
        {
            _loggerFactory = loggerFactory;
        }

        public INodeDiscoveryProvider Create(DiscoveryOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return new ConsulNodeDiscoveryProvider(_loggerFactory, options);
        }
    }
}
